import {Message} from "element-ui";
import axios from "axios";

// create an axios instance
const instance = axios.create({
    baseURL: '/api', // url = base url + request url

})

// request interceptor//请求拦截器
instance.interceptors.request.use(
    config => {
        return config
    },
    error => {
        console.log(error)
        return Promise.reject(error)
    }
)
// response interceptor响应拦截器
instance.interceptors.response.use(
)

let base = '';

export const postRequest = (url, params) => {
    return instance({
        method: 'post',
        url: `${base}${url}`,
        data: params
    })
};

export const getRequest = (url, params) => {
    return instance({
        method: 'get',
        url: `${base}${url}`,
        params: params
    })
};

